//
//  MyBankCardTableViewCell.m
//  YTwallet
//
//  Created by ZhangLin on 2019/3/12.
//  Copyright © 2019年 hadrlog. All rights reserved.
//

#import "MyBankCardTableViewCell.h"
#import <Masonry.h>
#import "UIView+AZGradient.h"
@implementation MyBankCardTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setupViews];
    }
    return self;
}

-(void)setupViews
{    
    self.bankCardView = [[UIView alloc] init];
    self.bankCardView.layer.cornerRadius = 5;
    self.bankCardView.layer.shadowOpacity = 0.5;
    self.bankCardView.layer.shadowRadius = 5;
    self.bankCardView.layer.shadowOffset = CGSizeMake(0, 5);
    [self.contentView addSubview:self.bankCardView];
    
    
    self.bankNameLab = [[UILabel alloc] init];
    self.bankNameLab.text = @"工商银行";
    self.bankNameLab.textColor = [UIColor whiteColor];
    self.bankNameLab.font = [UIFont systemFontOfSize:16];
    [self.bankCardView addSubview:self.bankNameLab];
    
   
    
    self.bankNameValueLab = [[UILabel alloc] init];
    self.bankNameValueLab.text = @"信用卡";
    self.bankNameValueLab.textColor = [UIColor whiteColor];
    self.bankNameValueLab.font = [UIFont systemFontOfSize:14];
    [self.bankCardView addSubview:self.bankNameValueLab];
    
    
    self.bankNumLab = [[UILabel alloc] init];
    self.bankNumLab.text = @"6235";
    self.bankNumLab.textAlignment = NSTextAlignmentCenter;
    self.bankNumLab.textColor = [UIColor whiteColor];
    self.bankNumLab.font = [UIFont systemFontOfSize:20];
    [self.bankCardView addSubview:self.bankNumLab];
    
    
    self.pointImv = [[UIImageView alloc] init];
    self.pointImv.image = [UIImage imageNamed:@"card_icon_smallcircle"];
    [self.bankCardView addSubview:self.pointImv];
    
     
    
}
-(void)layoutSubviews
{
    [super layoutSubviews];
    [self.bankCardView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(20);
        make.right.mas_equalTo(-20);
        make.top.mas_equalTo(10);
        make.bottom.mas_offset(-10);
    }];
    
    [self.bankNameLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(20);
        make.top.mas_equalTo(20);
    }];
    
    [self.bankNameValueLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-20);
        make.centerY.equalTo(self.bankNameLab);
    }];
    
    [self.bankNumLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.bankCardView).offset(60);
        make.bottom.equalTo(self.bankCardView).offset(-30);
    }];
    
    [self.pointImv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.bankNumLab.mas_left).offset(-20);
        make.centerY.equalTo(self.bankNumLab);
    }];
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
